package com.qk.management.mapper;


import com.qk.dto.course.CourseDTO;
import com.qk.entity.Course;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: ZgYn
 * @Date 2025/10/8 19:49
 * @name：CourseMapper
 */
@Mapper
public interface CourseMapper{
    List<Course> selectByExample(CourseDTO courseDTO);

    int insert(Course course);

    @Delete("DELETE FROM course WHERE id = #{id}")
    void delete(Integer id);

    @Select("SELECT * FROM course WHERE id = #{id}")
    Course get(Integer id);

    @Insert("UPDATE course SET name = #{name}, price = #{price},subject=#{subject},target=#{target}, description = #{description}, update_time = #{updateTime} WHERE id = #{id}")
    void update(Course course);

    @Select("SELECT * FROM course")
    List<Course> selectList();
    @Select("SELECT * FROM course WHERE subject = #{subject}")
    List<Course> selectBySubject(String subject);
}
